<xsl:template match='/'>  
<html>
<head> 
  <style>     
 			BODY{font-family: Verdana,Arial, Helvetica;
      		font-weight: normal;
         	font-size: 10pt;
        	line-height:12pt}
     	TD{font-family: Verdana,Arial, Helvetica;
        	font-weight: normal;
        	font-size: 10pt;
        	line-height:12pt;
        	text-align:center}
     TH{font-family:Verdana,Arial, Helvetica;
        	font-weight: bold;
        	font-size: 10pt;
        	line-height:12pt;
        	text-align:center}
    .lln {font-family: Verdana,Arial, Helvetica;
        	font-weight: bold;
        	font-size: 10pt;
        	line-height:12pt;
        	text-align:left}       	
    TABLE{border-collapse: collapse;
        	margin-top:0.1cm}
.blokL{ font-family: Verdana,Arial, Helvetica;
   	font-size: 10px;
	font-weight: normal;
	margin:0px;	
	text-align:left;
	width:22px}

.blokR{ font-family: Verdana,Arial, Helvetica;
   	font-size: 10px;
	font-weight: normal;
	margin:0px;
	text-align: right;
	width:22px}

.blok{ font-family: Verdana,Arial, Helvetica;
   	font-size: 12px;
	font-weight: normal;
	margin:0px;	
	width:46px}        	
        
   </style>  
</head>
  
<body>
<table border='1'>
<tr width="90%"><th colspan='100'>Sint-Ritacollege Overzicht semestercijfers 1 <xsl:value-of select='//rapport[1]/@jaar' />-<xsl:value-of select='//rapport[1]/@jaar + 1' /> &#160; <xsl:value-of select='//rapport[1]/leerling/klas' /></th></tr>

<tr><th /><xsl:for-each select="//rapport[1]/vakken/*">
    <xsl:call-template name="vakken" />
    </xsl:for-each><th>TOT</th></tr>

<tr><th colspan="100"></th></tr>

<xsl:for-each select="//rapport">
  <xsl:call-template name="vakcijfers" />
</xsl:for-each>

<tr><th colspan="100"></th></tr>

<xsl:for-each select="//rapport[1]">
  <xsl:call-template name="gemiddeldecijfers" />
</xsl:for-each>
 
</table>	  
</body>	   
</html>
</xsl:template>

<xsl:template name="vakken">
  <td>
<div class="blok">
	<span class="blokL">d&#13;</span>
	<span class="blokR">&#13;p</span>
</div>
<div class="blok"> T </div>
<xsl:value-of select='name()' />
</td>
</xsl:template>

<xsl:template name="vakcijfers">
   <tr><th><xsl:value-of select="leerling/voornaam" />&#160;<xsl:value-of select="leerling/achternaam" /> </th>
   <xsl:for-each select="vakken/*">
   <td> 
    <div class="blok">
      <span class="blokL"><xsl:for-each select='dw1'><xsl:call-template name="kleur" /></xsl:for-each>&#13;</span>
      <span class="blokR">&#13;<xsl:for-each select="ex1"><xsl:call-template name="kleur"/></xsl:for-each></span>
    </div>
    <div class="blok"><xsl:for-each select="tot1"><xsl:call-template name="kleur"/></xsl:for-each></div>
  </td>
  </xsl:for-each>
  <td><div  class="blok"><xsl:value-of select="totaal/tottot1" /></div></td>
  </tr>
</xsl:template>

<xsl:template name="gemiddeldecijfers">
   <tr><th>Gemiddelde</th>
   <xsl:for-each select="vakken/*"><td> 
  <div class="blok">
	<span class="blokL"><xsl:for-each select="dw1gem"><xsl:call-template name="kleur" /></xsl:for-each>&#13;</span><span class="blokR">&#13;<xsl:for-each select="ex1gem"><xsl:call-template name="kleur" /></xsl:for-each></span>
  </div>
  <div class="blok"><xsl:for-each select="tot1gem"><xsl:call-template name="kleur" /></xsl:for-each></div>
  </td>
  </xsl:for-each>
  <td><div  class="blok"><xsl:for-each select="totaal/tottot1gem"><xsl:call-template name="kleur" /></xsl:for-each></div></td>
  </tr>
</xsl:template>

<xsl:template name="kleur">
    <font>
      <xsl:attribute name="color">
		    <xsl:choose>
	  				<xsl:when test=". &lt; 50">#ff0000</xsl:when>
	  				<xsl:otherwise>black</xsl:otherwise>
		    </xsl:choose>
  	  </xsl:attribute>	
      <xsl:value-of select="." />
    </font>
</xsl:template>

